package com.ruoyi.hr.controller.hr.contractmanage;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.service.AuthorityService;
import com.ruoyi.hr.service.contractmanage.HistoryContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * @author zeo
 * @explain 合同管理历史
 * @date 2020/3/25
 */
@Controller
@RequestMapping("/contractManage/historyContract")
public class HistoryContractController extends BaseController {

    @Autowired
    AuthorityService authorityService;

    @Autowired
    HistoryContractService historyContractService;

    private String prefix = "hr/contractmanage/history";

    /**
     * 跳转分页页面
     */
    @GetMapping()
    public String histroyContract() {
        return prefix + "/historyContract";
    }

    @RequestMapping("/findDataList")
    @ResponseBody
    public TableDataInfo findDataList(@RequestParam Map map) {
        Authority authority = authorityService.findAuthorAndIsAdmin();
        startPage();
        return getDataTable(historyContractService.findDataList(map, authority));
    }
}
